package com.ciaojian.worker.controller;

import com.ciaojian.core.model.Roster;
import com.ciaojian.core.util.Result;
import com.ciaojian.worker.service.RosterServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author Atlakyn
 */
@Api(tags = "班次")
@RestController
@RequestMapping("/rosters")
public class RosterController {

    @Resource
    private RosterServiceImpl rosterService;

    @ApiOperation("门店班次")
    @ApiResponses({
            @ApiResponse(code = 200, message = "success", response = Roster.class)
    })
    @GetMapping("/store/{storeId}")
    public Result getByStoreId(@PathVariable Integer storeId) {
        Assert.notNull(storeId, "门店id不能为空");
        return Result.ok(rosterService.findByStoreId(storeId));
    }
}
